package com.jg.visitor;

import com.jg.visitor.common.bean.AppConfigs;
import com.jg.visitor.common.service.GlobalConfigInitService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class InitRunner implements CommandLineRunner {

    @Resource
    private GlobalConfigInitService globalConfigInitService;
    @Resource
    private AppConfigs appConfigs;
    //@Resource
    //private KafkaMsgListener kafkaMsgListener;

    @Override
    public void run(String... args){
        //初始化全局配置
        log.info("初始化全局配置");
        globalConfigInitService.initConfigToCache();
        log.info("初始化全局配置 ================> success");
        log.info("app setting={}",appConfigs);

        //kafka监听
        //log.info("监听kafka...");
        //kafkaMsgListener.listenKafka();
    }
}
